package com.workpaper.app.workpaper.daily.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceLocator;
import org.eclipse.jface.window.Window;

import com.workpaper.app.cache.resource.ViewInfoCache;
import com.workpaper.app.consts.AppConsts;
import com.workpaper.app.consts.common.CommonViewConsts;
import com.workpaper.app.consts.resources.IconPath;
import com.workpaper.app.workpaper.daily.view.DailyWorkpaperEditDialog;
/**
 * 新增工作日报按钮
 * @author zhouyj
 *
 */
public class AddDailyWorkpaperAction extends Action{

	public AddDailyWorkpaperAction() {
		this(ViewInfoCache.get(CommonViewConsts.ButtonText_Add), 
				ResourceLocator.imageDescriptorFromBundle(AppConsts.APP_ID, IconPath.BtnIcon_add).get());
		
	}


	private AddDailyWorkpaperAction(String text, ImageDescriptor image) {
		super(text, image);
	}


	@Override
	public void run() {
		DailyWorkpaperEditDialog aditDialog = new DailyWorkpaperEditDialog(null);
		int resultCode = aditDialog.open();
		
//		DataSourceEditor dataSourceEditor = new DataSourceEditor(null);
//		int resultCode = dataSourceEditor.open();
		if(resultCode == Window.OK) {
			System.out.println("正常关闭.....");
		}
		System.out.println("新增弹框");
		super.run();
	}
}
